<%@ page 
language="java" 
import="java.util.*" 
import="com.csd.helper.IConstant"
import="com.csd.vo.UserVO"
pageEncoding="UTF-8"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

HttpSession s = request.getSession();
UserVO uvo =  (UserVO)s.getAttribute(IConstant.userVO);
if(uvo==null || !uvo.getType().equals(IConstant.managerRole) )
{
	response.sendRedirect(path+"/error.jsp?info=Sorry, you ware not login, yet!");
	return;
}

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>    
    <title>添加新闻</title>
    <link rel="stylesheet" type="text/css" href="<%=path%>/admin/css/admin_right.css" />
    <script type="text/javascript" src="<%=path%>/admin/js/check.js"></script>
    <script type="text/javascript">
    function checkNews(form){
    var flag = true;
    var title = document.getElementsByName('news.title');
    var publisher = document.getElementsByName('news.publisher');
    var content = document.getElementsByName('news.content');
    if(title[0].value == ""){
    checkNotNull(title[0]);
    }
    if(publisher[0].value == ""){
    checkNotNull(publisher[0]);
    }
    if(content[0].value == ""){
    checkNotNull(content[0]);
    }
    flag = checkForm(form);
    return flag;
    }
    </script>
  </head>
  
  <body>
    <div class="main">
    	<h1>发布新闻</h1>
    	<hr />
    	<form action="<%=path %>/newsAdd.action" method="post" onsubmit="return checkNews(this);">
    	<table>
    		<tr>
    			<td>新闻标题</td>
    			<td><input name="news.title" type="text" maxlength="20" onblur="checkNotNull(this);" onkeyup="checkNotNull(this);"/></td>
    		</tr>
    		<tr>
    			<td>发布者：</td>
    			<td><input name="news.publisher" type="text" maxlength="20" onblur="checkNotNull(this);" onkeyup="checkNotNull(this);"/></td>
    		</tr>
    		<tr>
    			<td colspan="2">内容：</td>
    		</tr>
    		<tr>
    			<td colspan="2">
    				<textarea name="news.content" rows="10" cols="60" onblur="checkNotNull(this);" onkeyup="checkNotNull(this);"></textarea>
    			</td>
    		</tr>
    		<tr>
    			<td colspan="2">
    				<input type="submit" value="  提交  " />
    			</td>
    		</tr>
    	</table>
    	</form>
    </div>
  </body>
</html>
